package org.example.heap;
/**
 * 测试大对象直接跳过Eden区直接进入老年代
 * -Xms60m -Xmx60m -XX:NewRatio=2 -XX:SurvivorRatio=8 -XX:+PrintGCDetails
 * @author youshang
 * @date 2022/03/22 21:53
 **/
public class YoungOldAreaTest {
    public static void main(String[] args) {
        byte[] bytes = new byte[1024 * 1024 * 20]; //20m
        //注意：ParOldGen  used 20480k 大对象直接被分配到了 老年代

        /**
         * Heap
         *  PSYoungGen      total 18432K, used 3623K [0x00000007bec00000, 0x00000007c0000000, 0x00000007c0000000)
         *   eden space 16384K, 22% used [0x00000007bec00000,0x00000007bef89ff0,0x00000007bfc00000)
         *   from space 2048K, 0% used [0x00000007bfe00000,0x00000007bfe00000,0x00000007c0000000)
         *   to   space 2048K, 0% used [0x00000007bfc00000,0x00000007bfc00000,0x00000007bfe00000)
         *  ParOldGen       total 40960K, used 20480K [0x00000007bc400000, 0x00000007bec00000, 0x00000007bec00000)
         *   object space 40960K, 50% used [0x00000007bc400000,0x00000007bd800010,0x00000007bec00000)
         *  Metaspace       used 2955K, capacity 4556K, committed 4864K, reserved 1056768K
         *   class space    used 312K, capacity 392K, committed 512K, reserved 1048576K
         */
    }
}
